{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    ":dep ndarray = \"0.15.6\"\n",
    ":dep plotly = { version = \">=0.7.0\" }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "extern crate ndarray;\n",
    "extern crate plotly;\n",
    "extern crate rand_distr;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "use ndarray::Array;\n",
    "use plotly::common::Mode;\n",
    "use plotly::layout::{Layout};\n",
    "use plotly::{Plot, Scatter};\n",
    "use rand_distr::{num_traits::Float, Distribution};"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "let x0 = Array::linspace(1.0, 3.0, 200).into_raw_vec();\n",
    "let y0 = x0.iter().map(|v| *v * (v.powf(2.)).sin() + 1.).collect();\n",
    "\n",
    "let trace = Scatter::new(x0, y0);\n",
    "let mut plot = Plot::new();\n",
    "plot.add_trace(trace);\n",
    "\n",
    "let layout = Layout::new().height(525);\n",
    "plot.set_layout(layout);\n",
    "\n",
    "plot.lab_display();\n",
    "format!(\"EVCXR_BEGIN_CONTENT application/vnd.plotly.v1+json\\n{}\\nEVCXR_END_CONTENT\", plot.to_json())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Rust",
   "language": "rust",
   "name": "rust"
  },
  "language_info": {
   "codemirror_mode": "rust",
   "file_extension": ".rs",
   "mimetype": "text/rust",
   "name": "Rust",
   "pygment_lexer": "rust",
   "version": ""
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
